package com.bzkj.basicinfo.mapper;

import com.bzkj.basicinfo.domain.basic.BasicStoArea;
import com.bzkj.basicinfo.domain.basic.vo.WarehouseExportVo;
import com.bzkj.basicinfo.domain.ncc.Warehouse;
import com.bzkj.basicinfo.domain.wms.vo.ExportWMSWarehouseOutDetailVo;
import com.bzkj.basicinfo.domain.wms.vo.SkuQueryExportDataVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: Admin
 * @Description: 仓库数据访问层接口
 * 负责对仓库相关数据的 CRUD 操作
 */
@Mapper
public interface WarehouseMapper
{

    /**
     * 新增仓库
     *
     * @param warehouse 要新增的仓库对象
     * @return 受影响的记录数
     */
    int insertWarehouse(Warehouse warehouse);

    /**
     * 更新仓库
     *
     * @param warehouse 要更新的仓库对象
     * @return 受影响的记录数
     */
    int updateWarehouse(Warehouse warehouse);

    /**
     * 根据 ID 查询仓库
     *
     * @param stoId 仓库的唯一标识符
     * @return 查询到的仓库对象
     */
    Warehouse selectWarehouseById(String stoId);
    BasicStoArea selectBasicStoAreaById(String stoId);

    Warehouse selectByStoName(String stoName);

    /**
     * 根据ncc所属仓库查询数据
     *
     * @param def1
     * @return
     */
    List<Warehouse> selectByDef1(String def1);

    /**
     * 查询所有仓库
     *
     * @return 所有仓库的列表
     */
    List<Warehouse> selectAllWarehouses(Warehouse warehouse);
    List<Warehouse> selectWarehouses(Warehouse warehouse);

    /**
     * 删除仓库
     *
     * @param stoId 要删除的仓库的唯一标识符
     * @return 受影响的记录数
     */
    int deleteWarehouse(String stoId);

    String queryId(Long deptId);

    int insertStockMap(Map<String, Object> params);

    void deleteStockMap(String stoId);

    List<HashMap> getBasicStoStock();

    List<HashMap<String, Object>> queryStoWareHouse(@Param("sto_code") String sto_code);

    Long queryBigNumber();

    String selectDataDic(@Param("UID") int UID);

    int updateEnableStatus(@Param("status") String status, @Param("stoId") String stoId);

    Warehouse selectByStoId(String stoCode);

    void updateStockMap(@Param("stoId") String stoId, @Param("def1") String def1);

    List<String> selectDataDicList(@Param("start") int startNumber, @Param("num") int num);

    int selectDataDicListByUValue(@Param("value") String value);

    List<HashMap<String, Object>> getWarehouseInBasic(@Param("dataType") String dataType, @Param("mode") String mode, @Param("sType") String sType);

    List<HashMap<String, Object>> getWarehouseInNoFinishBills(@Param("dataType") String dataType, @Param("wareHouseMode") String wareHouseMode, @Param("noFinishMode") String noFinishMode);

    List<HashMap<String, Object>> getWarehouseInStatistic(@Param("dataType") String dataType,
                                                          @Param("wareHouseMode") String wareHouseMode,
                                                          @Param("wareHouseModeValue") String wareHouseModeValue,
                                                          @Param("wareHouseName") String wareHouseName,
                                                          @Param("wareHouseValue") String wareHouseValue,
                                                          @Param("senderId") String senderId,
                                                          @Param("senderValue") String senderValue,
                                                          @Param("skuId") String skuId,
                                                          @Param("skuIdValue") String skuIdValue,
                                                          @Param("sType") String sType
    );

    List<HashMap<String, Object>> getWarehouseOutBasic(@Param("dataType") String dataType, @Param("wareHouseMode") String wareHouseMode, @Param("sType") String sType);

    List<HashMap<String, Object>> getWarehouseOutNoFinishBills(@Param("dataType") String dataType, @Param("wareHouseMode") String wareHouseMode, @Param("noFinishMode") String noFinishMode);

    List<HashMap<String, Object>> getWarehouseOutStatistic(@Param("dataType") String dataType, @Param("wareHouseMode") String wareHouseMode, @Param("wareHouseModeValue") String wareHouseModeValue, @Param("wareHouseName") String wareHouseName, @Param("wareHouseValue") String wareHouseValue, @Param("customerId") String customerId, @Param("senderValue") String senderValue, @Param("skuId") String skuId, @Param("skuIdValue") String skuIdValue, @Param("sType") String sType);

    List<HashMap<String, Object>> findAuditBills(String billsID);

    List<HashMap<String, Object>> findAuditSku(@Param("skuId") String skuId, @Param("batchNo") String batchNo, @Param("barCode") String barCode, @Param("beginDate") String beginDate, @Param("endDate") String endDate);

    List<HashMap<String, Object>> findAuditUser(@Param("userId") String userId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);

    List<HashMap<String, Object>> findStatisticSto(String stoCode);

    List<HashMap<String, Object>> getStoUnitQuery(@Param("stoCode") String stoCode, @Param("unitIdValue") String unitIdValue, @Param("unitId") String unitId);

    List<HashMap<String, Object>> getSkuAlarms(@Param("alarmsMode") String alarmsMode,
                                               @Param("vBatchNo") String vBatchNo, @Param("drugName") String drugName,
                                               @Param("startDate") String startDate, @Param("endDate") String endDate,
                                               @Param("alarmsValues") String alarmsValues
                                               );

    List<HashMap<String, Object>> getWarehouseOutDetailProductPrint(@Param("cgeneralbid") List<String> cgeneralbid);

    List<HashMap<String, Object>> getStatisticStoUnit(@Param("stoAreaCode") String stoAreaCode, @Param("stoUnitCode") String stoUnitCode);

    List<HashMap<String, Object>> getSkuQuery(@Param("skuId") String skuId, @Param("batchNoMode") String batchNoMode, @Param("pkBatchNo") String pkBatchNo);

    List<HashMap<String, Object>> getWarehouseStatistic(@Param("skuclassId") String skuclassId, @Param("skuclassValue") String skuclassValue, @Param("wareHouseID") String wareHouseID, @Param("wareHouseValue") String wareHouseValue, @Param("skuID") String skuID, @Param("skuIDValue") String skuIDValue, @Param("batchNo") String batchNo, @Param("batchNoValue") String batchNoValue, @Param("expDateNum") String expDateNum, @Param("expDateValue") String expDateValue, @Param("resetDateNum") String resetDateNum, @Param("resetDateValue") String resetDateValue, @Param("stockNum") String stockNum, @Param("stocValue") String stocValue, @Param("skuState") String skuState, @Param("skuStateValue") String skuStateValue, @Param("sType") String sType);

    List<HashMap<String, Object>> getWarehouseBasic(String sType);

    List<HashMap<String, Object>> getBillStatusAll();

    List<HashMap<String, Object>> findTurnoverStatistic(@Param("beginDate") String beginDate, @Param("rndDate") String rndDate, @Param("skuClass") String skuClass, @Param("skuClassValue") String skuClassValue, @Param("wareHouseName") String wareHouseName, @Param("wareHouseValue") String wareHouseValue, @Param("skuID") String skuID, @Param("skuIDValue") String skuIDValue, @Param("batchNo") String batchNo, @Param("batchNoValue") String batchNoValue, @Param("skuState") String skuState, @Param("sType") String sType);

    List<SkuQueryExportDataVo> skuQueryExportData(@Param("skuclassId") String skuclassId, @Param("skuclassValue") String skuclassValue, @Param("wareHouseID") String wareHouseID, @Param("wareHouseValue") String wareHouseValue, @Param("skuID") String skuID, @Param("skuIDValue") String skuIDValue, @Param("batchNo") String batchNo, @Param("batchNoValue") String batchNoValue, @Param("expDateNum") String expDateNum, @Param("expDateValue") String expDateValue, @Param("resetDateNum") String resetDateNum, @Param("resetDateValue") String resetDateValue, @Param("stockNum") String stockNum, @Param("stocValue") String stocValue, @Param("skuState") String skuState, @Param("skuStateValue") String skuStateValue, @Param("sType") String sType);

    List<WarehouseExportVo> exportWareHouseStatistic(@Param("skuclassId") String skuclassId, @Param("skuclassValue") String skuclassValue, @Param("wareHouseID") String wareHouseID, @Param("wareHouseValue") String wareHouseValue, @Param("skuID") String skuID, @Param("skuIDValue") String skuIDValue, @Param("batchNo") String batchNo, @Param("batchNoValue") String batchNoValue, @Param("expDateNum") String expDateNum, @Param("expDateValue") String expDateValue, @Param("resetDateNum") String resetDateNum, @Param("resetDateValue") String resetDateValue, @Param("stockNum") String stockNum, @Param("stocValue") String stocValue, @Param("skuState") String skuState, @Param("skuStateValue") String skuStateValue, @Param("sType") String sType);

    List<HashMap<String, Object>> wmsUserKpi(@Param("dataType") String dataType, @Param("sType") String sType);

    List<HashMap<String, Object>> getWMSWarehouseDetail(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("skuClass") String skuClass, @Param("skuClassValue") String skuClassValue, @Param("wareHouseName") String wareHouseName, @Param("wareHouseValue") String wareHouseValue, @Param("skuId") String skuId, @Param("skuIdValue") String skuIdValue, @Param("batchNo") String batchNo, @Param("batchNoValue") String batchNoValue);

    List<ExportWMSWarehouseOutDetailVo> exportWMSWarehouseDetail(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("skuClass") String skuClass, @Param("skuClassValue") String skuClassValue, @Param("wareHouseName") String wareHouseName, @Param("wareHouseValue") String wareHouseValue, @Param("skuId") String skuId, @Param("skuIdValue") String skuIdValue, @Param("batchNo") String batchNo, @Param("batchNoValue") String batchNoValue);

    /**
     * 请验管理
     *
     * @param skuID        商品ID
     * @param skuIDValue   商品ID 0：等于任意一个1：等于 2：不等于
     * @param batchNo      批号vBatchNo
     * @param batchNoValue 批号模式 0：等于任意一个 1：等于 2：不等于 3：包含 4：不包含
     * @return
     */
    List<HashMap<String, Object>> getMaterialVerify(  @Param("skuID") String skuID, @Param("skuIDValue") String skuIDValue, @Param("batchNo") String batchNo, @Param("batchNoValue") String batchNoValue);

}
